package com.scs.application.core.model;

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 */
@JacksonXmlRootElement(localName = "result")
@Data
@EqualsAndHashCode(callSuper = false)
public class PageResult<T> extends CommonResult<T> {

    private long count;

    public PageResult(boolean success, String msg, T data, long count) {
        super(success, msg, data);

        this.count = count;
    }

    public static <R> PageResult<R> ok(String msg, R data, long count) {
        return new PageResult<>(true, msg == null ? "操作成功" : msg, data, count);
    }

}
